#ifndef __USER_DATA_H__
#define __USER_DATA_H__


#include <stdbool.h>
#include "version.h"


#if (_FILE_SYSTEM_VERSION == 1)
#define PROGRAM_BIN             "/etc/config/cbin/net_camera"
#define FILE_ISP_CONF           "/etc/config/cbin/isp_gc2063.conf"
#define RINGS_PATH              "/etc/config/cbin/ring"
#endif

#if (_FILE_SYSTEM_VERSION == 2)

#define PROGRAM_BIN             "/user/app/net_camera"
#define FILE_ISP_CONF           "/user/app/isp_gc2063.conf"
#define RINGS_PATH              "/user/data/ring"
#endif

#if (_FILE_SYSTEM_VERSION == 3)
#define PROGRAM_BIN             "/user/app/net_camera"
#define FILE_ISP_CONF           "/user/app/isp_gc2063.conf"
#define RINGS_PATH              "/user/app/ring"

#endif


#define FILE_USER_DATA_PATH     "/etc/config/user_data.conf"
#define FILE_RFID_DATA_PATH     "/etc/config/rfid_data.conf"
#define FILE_LOCAL_LOG	        "/etc/config/local.log"
#define PS_IR_PATH              "/etc/config/ps_ir_3918.conf"    //保存ircut引脚和工作电平 以及硬件光敏的使用参数

#define RFID_CARD_MAX		    (50)
#define OWNUNIT                *userdata_get(USERDATA_UNIT)
#define OWNFLOOR                *userdata_get(USERDATA_FLOOR)
#define OWNINDEX                *userdata_get(USERDATA_INDEX)


typedef enum {
    USERDATA_UNIT = 0,
    USERDATA_FLOOR,
    USERDATA_INDEX,
    USERDATA_GATE_LOCK_TIME,

    USERDATA_TOTAL
}USERDATAINDEX;




typedef struct {
    int RFID_CARD_TOTAL;
    unsigned int RFID_CARD_ARR[RFID_CARD_MAX];
    int gate_lock_time;
}user_data_struct;

int* userdata_get(USERDATAINDEX index);
bool userdata_init(void);
bool userdata_save(void);
bool userdata_reset(void);

bool _init_rfid_data(void);
bool rfid_data_save(void);
bool rfid_data_add(unsigned int numb);
unsigned int rfid_data_get_number(int index);
bool is_rfid_data_exists(unsigned int numb);
bool rfid_data_del(int index);
bool rfid_data_sync(void);

#endif /* __USER_DATA_H__ */